<template>
    <div class="payment">
        <div class="paycontent">
            <div class="title"><span class="leftline"></span><span>支付设置</span></div>
            <el-collapse accordion v-model="activeNames">
                <el-collapse-item name="1">
                    <template slot="title">
                        <i class="el-icon-caret-bottom" v-show = 'activeNames != 1'></i><i class="el-icon-caret-top" v-show = 'activeNames == 1'></i>微信支付通道
                    </template>
                    <el-row class="pass-main-title">
                       <el-col :span="22">
                          <el-row>
                            <el-col :span="12">
                               <el-row>
                                  <el-col :span="8">
                                     编辑状态
                                  </el-col>
                                  <el-col :span="16">
                                    <!-- <el-radio v-model="radio" label="1">关闭</el-radio>
                                    <el-radio v-model="radio" label="2">开启</el-radio> -->
                                    <el-switch v-model="radioWeixinAll"
                                    :active-value="1"
                                    :inactive-value="0"
                                    active-color="#409EFF" 
                                    inactive-color="#ff4949"
                                    @change='changeAllStatus("radioWeixinAll")'
                                    >
                                    </el-switch>
                                  </el-col>
                                </el-row>
                            </el-col>
                           
                          </el-row>
                       </el-col>      
                    </el-row>
                    <!-- content -->
                    <el-row v-show='radioWeixinAll === 1' >
                      <el-row class="pass-main-title  topline">
                       <el-col :span="22">
                          <el-row>
                            <el-col :span="12">
                               <el-row>
                                  <el-col :span="8">
                                     通道开启状态
                                  </el-col>
                                  <el-col :span="16">
                                    <!-- <el-radio v-model="radio" label="1">关闭</el-radio>
                                    <el-radio v-model="radio" label="2">开启</el-radio> -->
                                    <el-switch v-model="weixinStatus.payways_status"
                                    :active-value="1"
                                    :inactive-value="0"
                                    active-color="#409EFF" 
                                    inactive-color="#ff4949"
                                    @change='changeSwitch("weixinStatus", "payways_status")'
                                    >
                                    </el-switch>
                                  </el-col>
                                </el-row>
                            </el-col>
                          </el-row>
                       </el-col>      
                      </el-row>
                      <el-row  class="partone ">
                       <el-col :span="22">
                          <el-row class="pass-main">
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                   收款状态
                                  </el-col>
                                  <el-col :span="15">
                                    <el-switch v-model="weixinStatus.receivables"
                                      :active-value=1
                                      :inactive-value=0
                                      active-color="#409EFF"
                                      inactive-color="#ff4949" @change='changeSwitch("weixinStatus", "receivables")'>
                                    </el-switch>
                                  </el-col>
                                </el-row>
                            </el-col>
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                   押金授权
                                  </el-col>
                                  <el-col :span="15">
                                    <el-switch
                                      v-model="weixinStatus.deposit_impower"
                                      :active-value=1
                                      :inactive-value=0
                                      active-color="#409EFF"
                                      inactive-color="#ff4949" @change='changeSwitch("weixinStatus", "deposit_impower")'>
                                    </el-switch>
                                  </el-col>
                                </el-row> 
                            </el-col>
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                    撤销预授权(解冻)
                                  </el-col>
                                  <el-col :span="15">
                                    <el-switch
                                      v-model="weixinStatus.revoke_fundauth"
                                      :active-value=1
                                      :inactive-value=0
                                      active-color="#409EFF"
                                      inactive-color="#ff4949" @change='changeSwitch("weixinStatus", "revoke_fundauth")'>
                                    </el-switch>
                                  </el-col>
                                </el-row>
                            </el-col>
                          </el-row>
                          <el-row class="pass-main">
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                   结算状态
                                  </el-col>
                                  <el-col :span="15">
                                    <el-switch
                                      v-model="weixinStatus.fundauth_pay"
                                      :active-value=1
                                      :inactive-value=0
                                      active-color="#409EFF"
                                      inactive-color="#ff4949" @change='changeSwitch("weixinStatus", "fundauth_pay")'>
                                    </el-switch>
                                    
                                  </el-col>
                                </el-row> 
                            </el-col>
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                   扫码授权
                                  </el-col>
                                  <el-col :span="15">
                                    <el-switch
                                      v-model="weixinStatus.ewn_impower"
                                      :active-value=1
                                      :inactive-value=0
                                      active-color="#409EFF"
                                      inactive-color="#ff4949" @change='changeSwitch("weixinStatus", "ewn_impower")'>
                                    </el-switch>
                                    
                                  </el-col>
                                </el-row> 
                            </el-col>
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                   隔日结算
                                  </el-col>
                                  <el-col :span="15">
                                     <el-switch
                                      v-model="weixinStatus.tomorrow_settlement"
                                      :active-value=1
                                      :inactive-value=0
                                      active-color="#409EFF"
                                      inactive-color="#ff4949"  @change='changeSwitch("weixinStatus", "tomorrow_settlement")'>
                                    </el-switch>
                                    
                                  </el-col>
                                </el-row> 
                            </el-col>
                          </el-row>
                          <el-row class="pass-main">
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                    短信预授权
                                  </el-col>
                                  <el-col :span="15">
                                     <el-switch
                                      v-model="weixinStatus.sms_pre_authorization"
                                      :active-value=1
                                      :inactive-value=0
                                      active-color="#409EFF"
                                      inactive-color="#ff4949" @change='changeSwitch("weixinStatus", "sms_pre_authorization")'>
                                    </el-switch>
                                  </el-col>
                                </el-row>
                            </el-col>
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                    退款
                                  </el-col>
                                  <el-col :span="15">
                                     <el-switch
                                      v-model="weixinStatus.refunt_status"
                                      :active-value=1
                                      :inactive-value=0
                                      active-color="#409EFF"
                                      inactive-color="#ff4949"  @change='changeSwitch("weixinStatus", "refunt_status")'>
                                    </el-switch>
                                    <el-select v-model="weixinStatus.refund_expiration_time" placeholder="请选择" class="ml20">
                                      <el-option
                                        v-for="item in optionsRefund"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                      </el-option>
                                    </el-select>
                                  </el-col>
                                </el-row>
                            </el-col>
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                    追加结算
                                  </el-col>
                                  <el-col :span="15">
                                     <el-switch
                                      v-model="weixinStatus.add_settlement"
                                      :active-value=1
                                      :inactive-value=0
                                      active-color="#409EFF"
                                      inactive-color="#ff4949" @change='changeSwitch("weixinStatus", "add_settlement")'>
                                    </el-switch>
                                    <el-select v-model="weixinStatus.add_settlement_time" placeholder="请选择" class="ml20">
                                      <el-option
                                        v-for="item in optionsSettlement"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                      </el-option>
                                    </el-select>
                                  </el-col>
                                </el-row>
                            </el-col>
                            
                          </el-row>
                          <el-row  class="pass-main">
                            <el-col :span="10">
                               <el-row>
                                  <el-col :span="9">
                                   当面付授权接口版本
                                  </el-col>
                                  <el-col :span="15">
                                     <el-select v-model="weixinStatus.face_pay_interface_version" placeholder="请选择">
                                      <el-option
                                        v-for="item in optionsversionWeixin"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                      </el-option>
                                    </el-select>
                                  </el-col>
                                </el-row> 
                            </el-col>
                          </el-row>
                           <el-row class="pass-main">
                            <el-col :span="12">
                               <el-row>
                                  <el-col :span="9">
                                    预授权到期处理方式
                                  </el-col>
                                  <el-col :span="15">
                                    <el-radio v-model="weixinStatus.pre_authorization_expore" :label=1>全额结算</el-radio>
                                    <el-radio v-model="weixinStatus.pre_authorization_expore" :label=2>全额解冻</el-radio>
                                    <el-radio v-model="weixinStatus.pre_authorization_expore" :label=3>不处理</el-radio>
                                  </el-col>
                                </el-row>
                            </el-col>
                            
                          </el-row>
                        </el-col>
                      </el-row> 
                      <el-table
                        v-loading="loading"
                        :data="weixinList"
                        stripe
                        style="width: 100%">
                        <el-table-column
                          prop="ways_id"
                          label="通道店铺ID"
                          width="180">
                        </el-table-column>
                        <el-table-column
                          prop="rates"
                          label="费率"
                          width="180">
                        </el-table-column>
                        <el-table-column
                          prop="face_pay_rate"
                          label="当面付费率">
                        </el-table-column>
                        <el-table-column
                          prop="created_at"
                          label="通道创建时间">
                        </el-table-column>
                        <el-table-column
                          prop="updated_at"
                          label="通道更新时间">
                        </el-table-column>
                        <el-table-column label="操作">
                            <template slot-scope="scope">
                                    <el-button type="primary" plain  size="small" @click="waysDetail(scope.row.ways_id)">详情</el-button>
                            </template>
                        </el-table-column>
                        <el-table-column>
                          <template slot-scope="scope">
                              <el-radio  v-model="radioweixin" :label="scope.row.ways_id"  @click.native.prevent="selectWayWeixin(scope.row.ways_id)">选用</el-radio>
                          </template>
                        </el-table-column>
                      </el-table>
                      
                    <div v-if="weixinOpen">
                      <div class="text-center mt20">暂未开通微信支付通道</div></div>
                      <div class="text-center bluefont pb20 bt-line mt20"><a href="javascript:;" @click="addwayscase('g_weixin',store_code)">新增微信支付通道</a></div>
                    
                    <div class="text-center bottom-btn">
                            <el-button size="medium">取消</el-button>
                            <el-button type="primary" size="medium"  @click="modifyWeixin" v-loading.fullscreen.lock="fullscreenLoading1">确定</el-button>
                    </div>
                  </el-row>
                </el-collapse-item>
                 <el-collapse-item name="2">
                    <template slot="title">
                    <i class="el-icon-caret-bottom" v-show = 'activeNames != 2'></i><i class="el-icon-caret-top" v-show = 'activeNames == 2'></i>支付宝通道管理
                     <!-- <div class="text-right set" @click.stop="open3"><img src="./../../public/img/set.png" />设置</div> -->
                    </template>
                     <!-- title -->
                    <el-row class="pass-main-title">
                       <el-col :span="22">
                          <el-row>
                            <el-col :span="12">
                               <el-row>
                                  <el-col :span="8">
                                     编辑状态
                                  </el-col>
                                  <el-col :span="16">
                                    <!-- <el-radio v-model="radio" label="1">关闭</el-radio>
                                    <el-radio v-model="radio" label="2">开启</el-radio> -->
                                    <el-switch
                                      v-model="radioAlipayAll"
                                      :active-value="1"
                                      :inactive-value="0"
                                      active-color="#409EFF" 
                                      inactive-color="#ff4949"
                                      @change='changeAllStatus("radioAlipayAll")'
                                    >
                                    </el-switch>
                                  </el-col>
                                </el-row>
                            </el-col>
                           
                          </el-row>
                       </el-col>      
                    </el-row>
                    <!-- content -->
                    <el-row v-show='radioAlipayAll == true' >
                      <el-row class="pass-main-title  topline">
                       <el-col :span="22">
                          <el-row>
                            <el-col :span="12">
                               <el-row>
                                  <el-col :span="8">
                                     通道开启状态
                                  </el-col>
                                  <el-col :span="16">
                                    <!-- <el-radio v-model="radio" label="1">关闭</el-radio>
                                    <el-radio v-model="radio" label="2">开启</el-radio> -->
                                    <el-switch v-model="alipayStatus.payways_status"
                                    :active-value="1"
                                    :inactive-value="0"
                                    active-color="#409EFF" 
                                    inactive-color="#ff4949"
                                    @change='changeSwitch("alipayStatus", "payways_status")'
                                    >
                                    </el-switch>
                                  </el-col>
                                </el-row>
                            </el-col>
                          </el-row>
                       </el-col>      
                      </el-row>
                      <el-row  class="partone ">
                       <el-col :span="22">
                          <el-row class="pass-main">
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                   收款状态
                                  </el-col>
                                  <el-col :span="15">
                                    <el-switch v-model="alipayStatus.receivables"
                                      :active-value="1"
                                      :inactive-value="0"
                                      active-color="#409EFF"
                                      inactive-color="#ff4949" @change='changeSwitch("alipayStatus", "receivables")'>
                                    </el-switch>
                                  </el-col>
                                </el-row>
                            </el-col>
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                   押金授权
                                  </el-col>
                                  <el-col :span="15">
                                    <el-switch
                                      v-model="alipayStatus.deposit_impower"
                                      :active-value="1"
                                      :inactive-value="0"
                                      active-color="#409EFF"
                                      inactive-color="#ff4949" @change='changeSwitch("alipayStatus", "deposit_impower")'>
                                    </el-switch>
                                  </el-col>
                                </el-row> 
                            </el-col>
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                    撤销预授权(解冻)
                                  </el-col>
                                  <el-col :span="15">
                                    <el-switch
                                      v-model="alipayStatus.revoke_fundauth"
                                      :active-value="1"
                                      :inactive-value="0"
                                      active-color="#409EFF"
                                      inactive-color="#ff4949" @change='changeSwitch("alipayStatus", "revoke_fundauth")'>
                                    </el-switch>
                                  </el-col>
                                </el-row>
                            </el-col>
                          </el-row>
                          <el-row class="pass-main">
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                   结算状态
                                  </el-col>
                                  <el-col :span="15">
                                    <el-switch
                                      v-model="alipayStatus.fundauth_pay"
                                      :active-value="1"
                                      :inactive-value="0"
                                      active-color="#409EFF"
                                      inactive-color="#ff4949" @change='changeSwitch("alipayStatus", "fundauth_pay")'>
                                    </el-switch>
                                    
                                  </el-col>
                                </el-row> 
                            </el-col>
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                   扫码授权
                                  </el-col>
                                  <el-col :span="15">
                                    <el-switch
                                      v-model="alipayStatus.ewn_impower"
                                      :active-value="1"
                                      :inactive-value="0"
                                      active-color="#409EFF"
                                      inactive-color="#ff4949" @change='changeSwitch("alipayStatus", "ewn_impower")'>
                                    </el-switch>
                                    
                                  </el-col>
                                </el-row> 
                            </el-col>
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                   隔日结算
                                  </el-col>
                                  <el-col :span="15">
                                     <el-switch
                                      v-model="alipayStatus.tomorrow_settlement"
                                      :active-value="1"
                                      :inactive-value="0"
                                      active-color="#409EFF"
                                      inactive-color="#ff4949"  @change='changeSwitch("alipayStatus", "tomorrow_settlement")'>
                                    </el-switch>
                                    
                                  </el-col>
                                </el-row> 
                            </el-col>
                          </el-row>
                          <el-row class="pass-main">
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                    短信预授权
                                  </el-col>
                                  <el-col :span="15">
                                     <el-switch
                                      v-model="alipayStatus.sms_pre_authorization"
                                      :active-value="1"
                                      :inactive-value="0"
                                      active-color="#409EFF"
                                      inactive-color="#ff4949" @change='changeSwitch("alipayStatus", "sms_pre_authorization")'>
                                    </el-switch>
                                  </el-col>
                                </el-row>
                            </el-col>
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                    退款
                                  </el-col>
                                  <el-col :span="15">
                                     <el-switch
                                      v-model="alipayStatus.refunt_status"
                                      :active-value="1"
                                      :inactive-value="0"
                                      active-color="#409EFF"
                                      inactive-color="#ff4949"  @change='changeSwitch("alipayStatus", "refunt_status")'>
                                    </el-switch>
                                    <el-select v-model="alipayStatus.refund_expiration_time" placeholder="请选择" class="ml20">
                                      <el-option
                                        v-for="item in optionsRefund"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                      </el-option>
                                    </el-select>
                                  </el-col>
                                </el-row>
                            </el-col>
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                    追加结算
                                  </el-col>
                                  <el-col :span="15">
                                     <el-switch
                                      v-model="alipayStatus.add_settlement"
                                      :active-value="1"
                                      :inactive-value="0"
                                      active-color="#409EFF"
                                      inactive-color="#ff4949" @change='changeSwitch("alipayStatus", "add_settlement")'>
                                    </el-switch>
                                    <el-select v-model="alipayStatus.add_settlement_time" placeholder="请选择" class="ml20">
                                      <el-option
                                        v-for="item in optionsSettlement"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                      </el-option>
                                    </el-select>
                                  </el-col>
                                </el-row>
                            </el-col>
                            
                          </el-row>
                          <el-row  class="pass-main">
                            <el-col :span="10">
                               <el-row>
                                  <el-col :span="9">
                                   当面付授权接口版本
                                  </el-col>
                                  <el-col :span="15">
                                     <el-select v-model="alipayStatus.face_pay_interface_version" placeholder="请选择">
                                      <el-option
                                        v-for="item in optionsversion"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                      </el-option>
                                    </el-select>
                                  </el-col>
                                </el-row> 
                            </el-col>
                          </el-row>
                           <el-row class="pass-main">
                            <el-col :span="12">
                               <el-row>
                                  <el-col :span="9">
                                    预授权到期处理方式
                                  </el-col>
                                  <el-col :span="15">
                                    <el-radio v-model="alipayStatus.pre_authorization_expore " :label=1>全额结算</el-radio>
                                    <el-radio v-model="alipayStatus.pre_authorization_expore" :label=2>全额解冻</el-radio>
                                    <el-radio v-model="alipayStatus.pre_authorization_expore" :label=3>不处理</el-radio>
                                  </el-col>
                                </el-row>
                            </el-col>
                            
                          </el-row>
                        </el-col>
                      </el-row> 
                      <el-table
                        :data="apliayList"
                        stripe
                        style="width: 100%">
                        <el-table-column
                          prop="ways_id"
                          label="通道店铺ID"
                          width="180">
                        </el-table-column>
                        <el-table-column
                          prop="rates"
                          label="费率"
                          width="180">
                        </el-table-column>
                        <el-table-column
                          prop="face_pay_rate"
                          label="当面付费率">
                        </el-table-column>
                        <el-table-column
                          prop="created_at"
                          label="通道创建时间">
                        </el-table-column>
                        <el-table-column
                          prop="updated_at"
                          label="通道更新时间">
                        </el-table-column>
                        <el-table-column label="操作">
                            <template slot-scope="scope">
                                    <el-button type="primary" plain  size="small" @click="waysDetail(scope.row.ways_id)">详情</el-button>
                            </template>
                        </el-table-column>
                        <el-table-column>
                          <template slot-scope="scope">
                              <el-radio  v-model="radio11" :label="scope.row.ways_id"  @click.native.prevent="selectWay(scope.row.ways_id,scope.row.status)">选用</el-radio>
                          </template>
                        </el-table-column>
                      </el-table>
                      <!--  -->
                      <div v-if="alipayOpen == true">
                        <div class="text-center mt20">暂未开通支付宝支付通道</div>
                      </div>
                       <!-- 新增支付宝通道 -->
                      <el-row  class="text-center pass-line bt-line"><span><a href="javascript:;" @click="addwayscase('g_alipay',store_code)">新增支付宝通道</a></span></el-row>
                      <div class="text-center bottom-btn">
                            <el-button size="medium">取消</el-button>
                            <el-button type="primary" size="medium"  @click="modifyAlipay" v-loading.fullscreen.lock="fullscreenLoading2">确定</el-button>
                      </div>
                  </el-row>
                    
                </el-collapse-item>
                 <el-collapse-item name="3">
                    <template slot="title">
                    <i class="el-icon-caret-bottom" v-show = 'activeNames != 3'></i><i class="el-icon-caret-top" v-show = 'activeNames == 3'></i>银行卡通道管理
                    </template>
                                  <el-row class="pass-main-title">
                       <el-col :span="22">
                          <el-row>
                            <el-col :span="12">
                               <el-row>
                                  <el-col :span="8">
                                     编辑状态
                                  </el-col>
                                  <el-col :span="16">
                                    <!-- <el-radio v-model="radio" label="1">关闭</el-radio>
                                    <el-radio v-model="radio" label="2">开启</el-radio> -->
                                    <el-switch
                                      v-model="radioBankAll"
                                      :active-value="1"
                                      :inactive-value="0"
                                      active-color="#409EFF" 
                                      inactive-color="#ff4949"
                                      @change='changeAllStatus("radioBankAll")'
                                    >
                                    </el-switch>
                                  </el-col>
                                </el-row>
                            </el-col>
                           
                          </el-row>
                       </el-col>      
                    </el-row>
                    <!-- content -->
                    <el-row v-show='radioBankAll == true' >
                      <el-row class="pass-main-title  topline">
                       <el-col :span="22">
                          <el-row>
                            <el-col :span="12">
                               <el-row>
                                  <el-col :span="8">
                                     通道开启状态
                                  </el-col>
                                  <el-col :span="16">
                                    <!-- <el-radio v-model="radio" label="1">关闭</el-radio>
                                    <el-radio v-model="radio" label="2">开启</el-radio> -->
                                    <el-switch v-model="bankStatus.payways_status"
                                    :active-value="1"
                                    :inactive-value="0"
                                    active-color="#409EFF" 
                                    inactive-color="#ff4949"
                                    @change='changeSwitch("bankStatus", "payways_status")'
                                    >
                                    </el-switch>
                                  </el-col>
                                </el-row>
                            </el-col>
                          </el-row>
                       </el-col>      
                      </el-row>
                      <el-row  class="partone ">
                       <el-col :span="22">
                          <el-row class="pass-main">
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                   收款状态
                                  </el-col>
                                  <el-col :span="15">
                                    <el-switch v-model="bankStatus.receivables"
                                      :active-value="1"
                                      :inactive-value="0"
                                      active-color="#409EFF"
                                      inactive-color="#ff4949" @change='changeSwitch("bankStatus", "receivables")'>
                                    </el-switch>
                                  </el-col>
                                </el-row>
                            </el-col>
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                   押金授权
                                  </el-col>
                                  <el-col :span="15">
                                    <el-switch
                                      v-model="bankStatus.deposit_impower"
                                      :active-value="1"
                                      :inactive-value="0"
                                      active-color="#409EFF"
                                      inactive-color="#ff4949" @change='changeSwitch("bankStatus", "deposit_impower")'>
                                    </el-switch>
                                  </el-col>
                                </el-row> 
                            </el-col>
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                    撤销预授权(解冻)
                                  </el-col>
                                  <el-col :span="15">
                                    <el-switch
                                      v-model="bankStatus.revoke_fundauth"
                                      :active-value="1"
                                      :inactive-value="0"
                                      active-color="#409EFF"
                                      inactive-color="#ff4949" @change='changeSwitch("bankStatus", "revoke_fundauth")'>
                                    </el-switch>
                                  </el-col>
                                </el-row>
                            </el-col>
                          </el-row>
                          <el-row class="pass-main">
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                   结算状态
                                  </el-col>
                                  <el-col :span="15">
                                    <el-switch
                                      v-model="bankStatus.fundauth_pay"
                                      :active-value="1"
                                      :inactive-value="0"
                                      active-color="#409EFF"
                                      inactive-color="#ff4949" @change='changeSwitch("bankStatus", "fundauth_pay")'>
                                    </el-switch>
                                    
                                  </el-col>
                                </el-row> 
                            </el-col>
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                   扫码授权
                                  </el-col>
                                  <el-col :span="15">
                                    <el-switch
                                      v-model="bankStatus.ewn_impower"
                                      :active-value="1"
                                      :inactive-value="0"
                                      active-color="#409EFF"
                                      inactive-color="#ff4949" @change='changeSwitch("bankStatus", "ewn_impower")'>
                                    </el-switch>
                                    
                                  </el-col>
                                </el-row> 
                            </el-col>
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                   隔日结算
                                  </el-col>
                                  <el-col :span="15">
                                     <el-switch
                                      v-model="bankStatus.tomorrow_settlement"
                                      :active-value="1"
                                      :inactive-value="0"
                                      active-color="#409EFF"
                                      inactive-color="#ff4949"  @change='changeSwitch("bankStatus", "tomorrow_settlement")'>
                                    </el-switch>
                                    
                                  </el-col>
                                </el-row> 
                            </el-col>
                          </el-row>
                          <el-row class="pass-main">
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                    短信预授权
                                  </el-col>
                                  <el-col :span="15">
                                     <el-switch
                                      v-model="bankStatus.sms_pre_authorization"
                                      :active-value="1"
                                      :inactive-value="0"
                                      active-color="#409EFF"
                                      inactive-color="#ff4949" @change='changeSwitch("bankStatus", "sms_pre_authorization")'>
                                    </el-switch>
                                  </el-col>
                                </el-row>
                            </el-col>
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                    退款
                                  </el-col>
                                  <el-col :span="15">
                                     <el-switch
                                      v-model="bankStatus.refunt_status"
                                      :active-value="1"
                                      :inactive-value="0"
                                      active-color="#409EFF"
                                      inactive-color="#ff4949"  @change='changeSwitch("bankStatus", "refunt_status")'>
                                    </el-switch>
                                    <el-select v-model="bankStatus.refund_expiration_time" placeholder="请选择" class="ml20">
                                      <el-option
                                        v-for="item in optionsRefund"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                      </el-option>
                                    </el-select>
                                  </el-col>
                                </el-row>
                            </el-col>
                            <el-col :span="8">
                               <el-row>
                                  <el-col :span="9">
                                    追加结算
                                  </el-col>
                                  <el-col :span="15">
                                     <el-switch
                                      v-model="bankStatus.add_settlement"
                                      :active-value="1"
                                      :inactive-value="0"
                                      active-color="#409EFF"
                                      inactive-color="#ff4949" @change='changeSwitch("bankStatus", "add_settlement")'>
                                    </el-switch>
                                    <el-select v-model="bankStatus.add_settlement_time" placeholder="请选择" class="ml20">
                                      <el-option
                                        v-for="item in optionsSettlement"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                      </el-option>
                                    </el-select>
                                  </el-col>
                                </el-row>
                            </el-col>
                            
                          </el-row>
                          <el-row  class="pass-main">
                            <el-col :span="10">
                               <el-row>
                                  <el-col :span="9">
                                   当面付授权接口版本
                                  </el-col>
                                  <el-col :span="15">
                                     <el-select v-model="bankStatus.face_pay_interface_version" placeholder="请选择">
                                      <el-option
                                        v-for="item in optionsversionBank"
                                        :key="item.value"
                                        :label="item.label"
                                        :value="item.value">
                                      </el-option>
                                    </el-select>
                                  </el-col>
                                </el-row> 
                            </el-col>
                          </el-row>
                           <el-row class="pass-main">
                            <el-col :span="12">
                               <el-row>
                                  <el-col :span="9">
                                    预授权到期处理方式
                                  </el-col>
                                  <el-col :span="15">
                                    <el-radio v-model="bankStatus.pre_authorization_expore" :label=1>全额结算</el-radio>
                                    <el-radio v-model="bankStatus.pre_authorization_expore" :label=2>全额解冻</el-radio>
                                    <el-radio v-model="bankStatus.pre_authorization_expore" :label=3>不处理</el-radio>
                                  </el-col>
                                </el-row>
                            </el-col>
                          </el-row>
                        </el-col>
                      </el-row> 
                      <el-table
                        :data="bankList"
                        stripe
                        style="width: 100%">
                        <el-table-column
                          prop="ways_id"
                          label="通道店铺ID"
                          width="180">
                        </el-table-column>
                        <el-table-column
                          prop="rates"
                          label="费率"
                          width="180">
                        </el-table-column>
                        <el-table-column
                          prop="face_pay_rate"
                          label="当面付费率">
                        </el-table-column>
                        <el-table-column
                          prop="created_at"
                          label="通道创建时间">
                        </el-table-column>
                        <el-table-column
                          prop="updated_at"
                          label="通道更新时间">
                        </el-table-column>
                        <el-table-column label="操作">
                            <template slot-scope="scope">
                                    <el-button type="primary" plain  size="small" @click="waysDetail(scope.row.ways_id)">详情</el-button>
                            </template>
                        </el-table-column>
                        <el-table-column>
                          <template slot-scope="scope">
                              <el-radio  v-model="radioBank" :label="scope.row.ways_id"  @click.native.prevent="selectWayBank(scope.row.ways_id)">选用</el-radio>
                          </template>
                        </el-table-column>
                      </el-table>
                    <div v-if = "bankOpen == true">
                      <div class="text-center mt20">暂未开通银行卡通道管理</div> </div>
                      <div class="text-center bluefont pb20 bt-line mt20"><a href="javascript:;" @click="addwayscase('g_sfbank',store_code)">新增银行卡通道</a></div>
                   
                     <div class="text-center bottom-btn">
                            <el-button size="medium">取消</el-button>
                            <el-button type="primary" size="medium"  @click="modifyBank" v-loading.fullscreen.lock="fullscreenLoading3">确定</el-button>
                    </div>
                  </el-row>
                   
                </el-collapse-item>
            </el-collapse>
        </div>
    </div>
</template>

<script>
import api from './../../api/api';
import http from './../../config/index';
export default {
  data () {
    return {
      token: localStorage.getItem('token'),
      fullscreenLoading1: false,
      fullscreenLoading2: false,
      fullscreenLoading3: false,
      // 加载圈
      loading: true,
      store_code: this.$route.query.store_code ? this.$route.query.store_code : '',
      activeNames: ['1'],
      bankOpen: true,
      weixinOpen: true,
      alipayOpen: true,
      // 支付宝通道状态
      radioAlipayAll: false,
      // 支付宝单选
      radio11: '',
      // 支付通道列表
      apliayList: [],
      // 支付宝状态
      alipayStatus: {
        // 是否被打开
        payways_status: 0,
        // 退款过期时间小时
        refund_expiration_time: '',
        // 追加结算时间小时
        add_settlement_time: '',
        // 收款状态
        receivables: 0,
        // 支付宝押金授权
        deposit_impower: 0,
        // 支付宝撤销预授权(解冻)
        revoke_fundauth: 0,
        // 支付宝结算状态
        fundauth_pay: 0,
        // 支付宝扫码授权
        ewn_impower: 0,
        // 支付宝隔日结算
        tomorrow_settlement: 0,
        // 支付宝短信预授权
        sms_pre_authorization: 0,
        // 支付宝退款
        refunt_status: 0,
        // 支付宝追加结算
        add_settlement: 0,
        // 支付宝预授权到期处理方式
        pre_authorization_expore: 0,
        // 支付宝当面付授权接口版本
        face_pay_interface_version: 'V1'
      },
      // 微信支付通道状态
      radioWeixinAll: 0,
      // 微信单选
      radioweixin: '',
      // 微信通道列表
      weixinList: [],
      weixinStatus: {
        // 是否被打开
        payways_status: 0,
        // 退款过期时间小时
        refund_expiration_time: '',
        // 追加结算时间小时
        add_settlement_time: '',
        // 收款状态
        receivables: 0,
        // 押金授权
        deposit_impower: 0,
        // 撤销预授权(解冻)
        revoke_fundauth: 0,
        // 结算状态
        fundauth_pay: 0,
        // 扫码授权
        ewn_impower: 0,
        // 隔日结算
        tomorrow_settlement: 0,
        // 短信预授权
        sms_pre_authorization: 0,
        // 退款
        refunt_status: 0,
        // 追加结算
        add_settlement: 0,
        // 预授权到期处理方式
        pre_authorization_expore: 0,
        // 当面付授权接口版本
        face_pay_interface_version: 'V1'
      },
      // 银行卡支付通道状态
      radioBankAll: false,
      // 银行卡单选
      radioBank: '',
      // 银行卡通道列表
      bankList: [],
      bankStatus: {
        // 是否被打开
        payways_status: 0,
        // 退款过期时间小时
        refund_expiration_time: '',
        // 追加结算时间小时
        add_settlement_time: '',
        // 收款状态
        receivables: 0,
        // 押金授权
        deposit_impower: 0,
        // 撤销预授权(解冻)
        revoke_fundauth: 0,
        // 结算状态
        fundauth_pay: 0,
        // 扫码授权
        ewn_impower: 0,
        // 隔日结算
        tomorrow_settlement: 0,
        // 短信预授权
        sms_pre_authorization: 0,
        // 退款
        refunt_status: 0,
        // 追加结算
        add_settlement: 0,
        // 预授权到期处理方式
        pre_authorization_expore: 0,
        // 当面付授权接口版本
        face_pay_interface_version: 'V1'
      },
      // 支付宝退款时间
      optionsRefund: [{
        value: '1',
        label: '1小时内(默认)'
      }, {
        value: '2',
        label: '2小时内'
      }, {
        value: '3',
        label: '3小时内'
      }, {
        value: '6',
        label: '6小时内'
      }, {
        value: '12',
        label: '12小时内'
      }, {
        value: '24',
        label: '24小时内'
      }, {
        value: '48',
        label: '48小时内'
      }],
      // 支付宝追加结算时间
      optionsSettlement: [{
        value: '1',
        label: '1小时'
      }, {
        value: '2',
        label: '2小时内'
      }, {
        value: '3',
        label: '3小时内'
      }, {
        value: '4',
        label: '4小时内'
      }, {
        value: '5',
        label: '5小时内'
      }, {
        value: '6',
        label: '6小时内'
      }, {
        value: '7',
        label: '7小时内'
      }, {
        value: '8',
        label: '8小时内'
      }, {
        value: '9',
        label: '9小时内'
      }, {
        value: '10',
        label: '10小时内'
      }, {
        value: '11',
        label: '11小时内'
      }, {
        value: '12',
        label: '12小时内'
      }, {
        value: '24',
        label: '24小时内'
      }, {
        value: '48',
        label: '48小时内'
      }],
      // 当面付授权接口版本
      optionsversion: [{
        value: 'V1',
        label: 'V1'
      }, {
        value: 'V2',
        label: 'V2'
      }, {
        value: 'V3',
        label: 'V3'
      }],
      // 微信退款时间
      optionsRefundWeixin: [{
        value: '1',
        label: '1小时内(默认)'
      }, {
        value: '2',
        label: '2小时内'
      }, {
        value: '3',
        label: '3小时内'
      }, {
        value: '6',
        label: '6小时内'
      }, {
        value: '12',
        label: '12小时内'
      }, {
        value: '24',
        label: '24小时内'
      }, {
        value: '48',
        label: '48小时内'
      }],
      // 微信追加结算时间
      optionsSettlementWeixin: [{
        value: '1',
        label: '1小时'
      }, {
        value: '2',
        label: '2小时内'
      }, {
        value: '3',
        label: '3小时内'
      }, {
        value: '4',
        label: '4小时内'
      }, {
        value: '5',
        label: '5小时内'
      }, {
        value: '6',
        label: '6小时内'
      }, {
        value: '7',
        label: '7小时内'
      }, {
        value: '8',
        label: '8小时内'
      }, {
        value: '9',
        label: '9小时内'
      }, {
        value: '10',
        label: '10小时内'
      }, {
        value: '11',
        label: '11小时内'
      }, {
        value: '12',
        label: '12小时内'
      }, {
        value: '24',
        label: '24小时内'
      }, {
        value: '48',
        label: '48小时内'
      }],
      // 微信当面付授权接口版本
      optionsversionWeixin: [{
        value: 'V1',
        label: 'V1'
      }, {
        value: 'V2',
        label: 'V2'
      }, {
        value: 'V3',
        label: 'V3'
      }],
      // 银行卡退款时间
      optionsRefundBank: [{
        value: '1',
        label: '1小时内(默认)'
      }, {
        value: '2',
        label: '2小时内'
      }, {
        value: '3',
        label: '3小时内'
      }, {
        value: '6',
        label: '6小时内'
      }, {
        value: '12',
        label: '12小时内'
      }, {
        value: '24',
        label: '24小时内'
      }, {
        value: '48',
        label: '48小时内'
      }],
      // 银行卡追加结算时间
      optionsSettlementBank: [{
        value: '1',
        label: '1小时'
      }, {
        value: '2',
        label: '2小时内'
      }, {
        value: '3',
        label: '3小时内'
      }, {
        value: '4',
        label: '4小时内'
      }, {
        value: '5',
        label: '5小时内'
      }, {
        value: '6',
        label: '6小时内'
      }, {
        value: '7',
        label: '7小时内'
      }, {
        value: '8',
        label: '8小时内'
      }, {
        value: '9',
        label: '9小时内'
      }, {
        value: '10',
        label: '10小时内'
      }, {
        value: '11',
        label: '11小时内'
      }, {
        value: '12',
        label: '12小时内'
      }, {
        value: '24',
        label: '24小时内'
      }, {
        value: '48',
        label: '48小时内'
      }],
      // 银行卡当面付授权接口版本
      optionsversionBank: [{
        value: 'V1',
        label: 'V1'
      }, {
        value: 'V2',
        label: 'V2'
      }, {
        value: 'V3',
        label: 'V3'
      }],
      // 微信防爆点击
      makesureWeixin: true,
      // 支付宝防爆点击
      makesureAlipay: true,
      // 银行防爆点击
      makesureBank: true,
      // 支付宝新数据
      newAlipayStatus: {},
      // 微信新数据
      newWeixinStatus: {},
      // 银行卡新数据
      newBankStatus: {}

    };
  },
  methods: {
    // 通道详情页面
    waysDetail (waysId) {
      // ways_id
      this.$router.push({
        name: 'payways-case-details',
        query: {
          ways_id: waysId
        }
      });
    },
    changeSwitch (type, name) {
      // this[type][name] = this[type][name] === 0 ? 1 : 0;
      console.log(this[type][name]);
    },
    changeAllStatus (selectAll) {
      // console.log(type);
      console.log(this[selectAll]);
      if (this[selectAll] === 0) {
        event.stopPropagation();
        this.$confirm('确定你修改的都保存成功了吗,如没保存,会恢复原来的设置?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
          center: true
        }).then(() => {
          this[selectAll] = 0;
          // 获取规则通道列表
          this.getRulelist();
          // 获取所有通道下的列表
          this.apliayListWay();
        }).catch(() => {
          this[selectAll] = 1;
        });
      }
    },
    addwayscase (type, storecode) {
      this.$router.push({
        name: 'payways-case-add',
        query: {
          type: type,
          store_code: storecode
        }
      });
    },
    open3 () {
      this.$prompt('输入当前账号登录密码，以便设置通道信息', '通道设置', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        inputPlaceholder: '请输入密码',
        inputType: 'password'
      })
      .then(() => {
        this.activeNames = ['2'];
      })
      .catch(action => {
        this.$message({
          type: 'info',
          message: action === 'cancel'
            ? '您点击了取消'
            : ''
        });
      });
    },
    deleteoptions () {
      this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        center: true
      }).then(() => {
        this.$message({
          type: 'success',
          message: '删除成功!'
        });
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    // 修改支付通道实列
    modifyAlipay () {
      var that = this;
      if (!that.makesureAlipay) {
        return false;
      }
      new Promise((resolve, reject) => {
        if (that.apliayList.length > 0) {
          if (that.radio11 === '') {
            that.$message.error('支付宝通道为必选,不能为空');
            return false;
          }
          that.makesureAlipay = false;
          // 请求出现加载圈
          that.fullscreenLoading2 = !that.fullscreenLoading2;
          // 提交选中实列
          http.post(api.paywayTypeMain, {
            token: that.token,
            store_code: that.$route.query.store_code,
            type: 'g_alipay',
            ways_id: that.radio11
          }, (res) => {
            console.log(res);
            console.log(88);
            that.makesureAlipay = true;
            // 请求出现加载圈
            that.fullscreenLoading2 = !that.fullscreenLoading2;
            if (res.code === '10001' && res.status === 'SUCCESS') {
              resolve(1);
              return false;
            } else {
              that.$message.error(res.msg);
              that.makesureAlipay = true;
            }
            reject(2);
          }, () => {
            that.$message.error('网络错误，请稍候再试');
          });
        } else {
          resolve(1);
          this.fullscreenLoading2 = !this.fullscreenLoading2;
        }
      }).then((data) => {
        that.makesureAlipay = false;
        // 修改支付实列
        http.post(api.ruleSave, {
          token: that.token,
          saveType: 'type',
          fields: '',
          type: 'g_alipay',
          store_code: that.$route.query.store_code,
          payways_status: that.alipayStatus.payways_status,
          receivables: that.alipayStatus.receivables,
          deposit_impower: that.alipayStatus.deposit_impower,
          revoke_fundauth: that.alipayStatus.revoke_fundauth,
          fundauth_pay: that.alipayStatus.fundauth_pay,
          ewn_impower: that.alipayStatus.ewn_impower,
          tomorrow_settlement: that.alipayStatus.tomorrow_settlement,
          sms_pre_authorization: that.alipayStatus.sms_pre_authorization,
          refunt_status: that.alipayStatus.refunt_status,
          add_settlement: that.alipayStatus.add_settlement,
          add_settlement_time: that.alipayStatus.add_settlement_time,
          refund_expiration_time: that.alipayStatus.refund_expiration_time,
          pre_authorization_expore: that.alipayStatus.pre_authorization_expore,
          face_pay_interface_version: that.alipayStatus.face_pay_interface_version
        }, (res) => {
          console.log(res);
          console.log(that.radioway10);
          console.log(8889);
          that.fullscreenLoading2 = !that.fullscreenLoading2;
          if (res.code === '10001' && res.status === 'SUCCESS') {
            that.$message.success('支付宝通道状态修改成功');
            setTimeout(function () {
              that.makesureAlipay = true;
            }, 3000);
            return false;
          } else {
            that.$message.error(res.msg);
            that.makesureAlipay = true;
          }
        }, () => {
          that.$message.error('网络错误，请稍候再试');
          that.makesureAlipay = true;
          that.fullscreenLoading2 = !that.fullscreenLoading2;
        });
      }, (err) => {
        console.log(err);
      });
    },
    // 修改微信通道实列
    modifyWeixin () {
      var that = this;
      if (!that.makesureWeixin) {
        return false;
      }
      new Promise((resolve, reject) => {
        if (that.weixinList.length > 0) {
          if (that.radioweixin === '') {
            that.$message.error('微信通道为必选,不能为空');
            return false;
          }
          // 防爆点击
          that.makesureWeixin = false;
          // 请求出现加载圈
          that.fullscreenLoading1 = !that.fullscreenLoading1;
          // 提交选中实列
          http.post(api.paywayTypeMain, {
            token: that.token,
            store_code: that.$route.query.store_code,
            type: 'g_weixin',
            ways_id: that.radioweixin
          }, (res) => {
            that.fullscreenLoading1 = !that.fullscreenLoading1;
            if (res.code === '10001' && res.status === 'SUCCESS') {
              resolve(1);
              return false;
            } else {
              that.$message.error(res.msg);
              that.makesureWeixin = true;
            }
            reject(2);
          }, () => {
            that.$message.error('网络错误，请稍候再试');
          });
        } else {
          resolve(1);
          that.fullscreenLoading1 = !that.fullscreenLoading1;
          console.log(1220);
          return false;
        }
      }).then((data) => {
        console.log(12205);
        that.makesureWeixin = false;
        // 修改微信通道实列
        http.post(api.ruleSave, {
          token: that.token,
          saveType: 'type',
          fields: '',
          type: 'g_weixin',
          store_code: that.$route.query.store_code,
          payways_status: that.weixinStatus.payways_status,
          receivables: that.weixinStatus.receivables,
          deposit_impower: that.weixinStatus.deposit_impower,
          revoke_fundauth: that.weixinStatus.revoke_fundauth,
          fundauth_pay: that.weixinStatus.fundauth_pay,
          ewn_impower: that.weixinStatus.ewn_impower,
          tomorrow_settlement: that.weixinStatus.tomorrow_settlement,
          sms_pre_authorization: that.weixinStatus.sms_pre_authorization,
          refunt_status: that.weixinStatus.refunt_status,
          add_settlement: that.weixinStatus.add_settlement,
          add_settlement_time: that.weixinStatus.add_settlement_time,
          refund_expiration_time: that.weixinStatus.refund_expiration_time,
          pre_authorization_expore: that.weixinStatus.pre_authorization_expore,
          face_pay_interface_version: that.weixinStatus.face_pay_interface_version
        }, (res) => {
          console.log(res);
          that.fullscreenLoading1 = !that.fullscreenLoading1;
          if (res.code === '10001' && res.status === 'SUCCESS') {
            that.$message.success('微信通道状态修改成功');
            setTimeout(function () {
              that.makesureWeixin = true;
            }, 3000);
            return false;
          } else {
            that.$message.error(res.msg);
            that.makesureWeixin = true;
          }
        }, () => {
          that.$message.error('网络错误，请稍候再试');
          that.makesureWeixin = true;
          that.fullscreenLoading1 = !that.fullscreenLoading1;
        });
      }, (err) => {
        console.log(err);
      });
    },
    // 修改银行卡通道实列
    modifyBank () {
      var that = this;
      if (!that.makesureBank) {
        return false;
      }
      new Promise((resolve, reject) => {
        if (that.bankList.length > 0) {
          if (that.radioBank === '') {
            that.$message.error('银行卡通道为必选,不能为空');
            return false;
          }
          // 防爆点击
          that.makesureBank = false;
          // 请求加载
          that.fullscreenLoading3 = !that.fullscreenLoading3;
          // 提交选中实列
          http.post(api.paywayTypeMain, {
            token: that.token,
            store_code: that.$route.query.store_code,
            type: 'g_sfbank',
            ways_id: that.radioBank
          }, (res) => {
            console.log(res);
            console.log(55);
            that.fullscreenLoading3 = !that.fullscreenLoading3;
            if (res.code === '10001' && res.status === 'SUCCESS') {
              resolve(1);
              return false;
            } else {
              that.$message.error(res.msg);
              that.makesureBank = true;
            }
            reject(2);
          }, () => {
            that.$message.error('网络错误，请稍候再试');
            that.makesureBank = true;
          });
        } else {
          resolve(1);
          that.fullscreenLoading3 = !that.fullscreenLoading3;
          return false;
        }
      }).then((data) => {
        that.makesureBank = false;
        // 修改银行卡通道实列
        http.post(api.ruleSave, {
          token: that.token,
          saveType: 'type',
          fields: '',
          type: 'g_sfbank',
          store_code: that.$route.query.store_code,
          payways_status: that.bankStatus.payways_status,
          receivables: that.bankStatus.receivables,
          deposit_impower: that.bankStatus.deposit_impower,
          revoke_fundauth: that.bankStatus.revoke_fundauth,
          fundauth_pay: that.bankStatus.fundauth_pay,
          ewn_impower: that.bankStatus.ewn_impower,
          tomorrow_settlement: that.bankStatus.tomorrow_settlement,
          sms_pre_authorization: that.bankStatus.sms_pre_authorization,
          refunt_status: that.bankStatus.refunt_status,
          add_settlement: that.bankStatus.add_settlement,
          add_settlement_time: that.bankStatus.add_settlement_time,
          refund_expiration_time: that.bankStatus.refund_expiration_time,
          pre_authorization_expore: that.bankStatus.pre_authorization_expore,
          face_pay_interface_version: that.bankStatus.face_pay_interface_version
        }, (res) => {
          console.log(res);
          console.log(22);
          that.fullscreenLoading3 = !that.fullscreenLoading3;
          if (res.code === '10001' && res.status === 'SUCCESS') {
            that.$message.success('银行通道状态修改成功');
            setTimeout(function () {
              that.makesureBank = true;
            }, 3000);
            return false;
          } else {
            that.$message.error(res.msg);
            that.makesureBank = true;
          }
        }, () => {
          that.$message.error('网络错误，请稍候再试');
          that.makesureBank = true;
          that.fullscreenLoading3 = !that.fullscreenLoading3;
        });
      }, (err) => {
        console.log(err);
      });
    },
    // 支付宝选用
    selectWay (wayId, statusRadio) {
      wayId === this.radio11 ? this.radio11 = '' : this.radio11 = wayId;
    },
    // 微信选用
    selectWayWeixin (wayId) {
      wayId === this.radioweixin ? this.radioweixin = '' : this.radioweixin = wayId;
    },
    // 银行卡选用
    selectWayBank (wayId) {
      wayId === this.radioBank ? this.radioBank = '' : this.radioBank = wayId;
    },
    apliayListWay () {
      var that = this;
      that.loading = true;
      // 获取所有支付通道实列接口
      http.post(api.queryWaysAll, {
        token: that.token,
        port: 'web',
        store_code: that.$route.query.store_code
      }, (res) => {
        console.log(res);
        console.log(99);
        if (res.code === '10001' && res.status === 'SUCCESS') {
          that.loading = false;
          // 获取支付宝列表
          that.apliayList = res.data[0].res.alipay;
          if (that.apliayList.length > 0) {
            that.alipayOpen = false;
          }
          // 获取支付宝默认选中的值payways_
          that.apliayList.forEach(item => {
            if (item.is_default === 1) {
              this.radio11 = item.ways_id;
            }
          });
          // 获取微信列表
          that.weixinList = res.data[0].res.weixin;
          if (that.weixinList.length > 0) {
            that.weixinOpen = false;
          }
          that.weixinList.forEach(item => {
            if (item.is_default === 1) {
              this.radioweixin = item.ways_id;
            }
          });
          // 获取银行列表
          that.bankList = res.data[0].res.sfbank;
          if (that.bankList.length > 0) {
            that.bankOpen = false;
          }
          that.bankList.forEach(item => {
            if (item.is_default === 1) {
              this.radioBank = item.ways_id;
            }
          });
        } else {
          that.$message.error(res.msg);
          that.loading = false;
        }
      }, () => {
        that.$message.error('网络错误，请稍候再试');
        that.loading = false;
        console.log(11);
      });
    },
    // 获取通道规则列表
    getRulelist () {
      var that = this;
      http.post(api.ruleList, {
        token: that.token,
        saveType: 'type',
        store_code: this.$route.query.store_code
      }, (res) => {
        console.log(res);
        console.log(6666);
        console.log(res.code);
        if (res.code === '10001' && res.status === 'SUCCESS') {
          console.log(res);
          console.log(9999);
          // 获取支付通道列表状态
          var paywaysDate = res.data[0].result;
          if (paywaysDate.hasOwnProperty('g_alipay')) {
            console.log(222222);
            // 存储支付宝原来的数据
            that.alipayStatus = res.data[0].result.g_alipay.payways_rules;
            // 修改后支付宝的数据
            that.newAlipayStatus = that.cloneObj(that.alipayStatus);
            // that.alipayStatus = that.newAlipayStatus;
            // that.newalipayStatus.created_at = '000';
            console.log(that.alipayStatus);
            console.log(that.newalipayStatus);
          }
          // 是否存在微信g_weixin这个字段
          if (paywaysDate.hasOwnProperty('g_weixin')) {
            that.weixinStatus = res.data[0].result.g_weixin.payways_rules;
            that.newWeixinStatus = that.cloneObj(that.weixinStatus);
          }
          // 是否存在银行卡这个字段
          if (paywaysDate.hasOwnProperty('g_sfbank')) {
            that.bankStatus = res.data[0].result.g_sfbank.payways_rules;
            that.newBankStatus = that.cloneObj(that.bankStatus);
          }
        }
      }, (err) => {
        console.log(err);
        console.log(555);
        that.$message.error('网络错误，请稍候再试');
      });
    },
    // 克隆对象方法封装
    cloneObj (obj) {
      var str = obj.constructor === Array ? [] : {};
      var newobj = obj.constructor === Array ? [] : {};
      if (typeof obj !== 'object') {
        return;
      } else if (window.JSON) {
        str = JSON.stringify(obj);// 序列化对象
        newobj = JSON.parse(str); // 还原
      } else {
        for (var i in obj) {
          newobj[i] = typeof obj[i] === 'object' ? this.cloneObj(obj[i]) : obj[i];
        }
      }
      return newobj;
    }
  },
  mounted: function () {
    var that = this;
    console.log(777);
    // 获取规则通道列表
    that.getRulelist();
    // 获取所有通道下的列表
    that.apliayListWay();
  }
};
</script>

<style lang="stylus" scoped>
@import url('./payment.css');
.payment
  .active
    color:#409EFF
  .in-active
    color:#ff4949
  .paycontent
    margin: 10px 0
    padding:0 10px
    box-sizing:border-box
    background-color:#fff
    box-shadow: 1px 1px 1px #999
    font-size:14px
    color:#333
  .bluefont
    a
      color: #409EFF
      text-decoration: underline
  .title
    padding:20px 0px 15px 0px
    box-sizing:border-box
    font-size:16px
    color:#999
  .leftline
    width:5px;
    height:15px;
    display:inline-block
    background:#36ADCB
    margin-right:5px
  .set
    float:right
    color:#333
    font-size:14px
    img
      width:13px
      height:12px
      margin-right:5px
  .bt-line
    border-bottom:1px solid #d8d8d8
  .topline
    border-top:1px solid #d8d8d8 
  .pass-main-title
    padding:20px 0
    box-sizing:border-box 
    font-size:14px
    color:#666 
  .pass-main
    padding-top:20px
    box-sizing:border-box 
    font-size:14px
    color:#666
  .el-radio
    color:#999
  .el-select
    width:100px
    height:20px
  .ml20
    margin-left:20px
  .form-all
    color:#333
    font-size:14px
  .form-title
    height:30px
    line-height:30px
  .form-content
    height:50px
    line-height:50px
    border-bottom:1px solid #d8d8d8
  .el-input
    width:75%
  .no-lineheight
    padding-top:5px
    box-sizing:border-box
    line-height:0px
  .partone
    padding-bottom:20px
    box-sizing:border-box
  .commonedit
    margin-left:5px
    margin-right:5px
  .redfont
    color:#FF4D4F
  .orangefont
    color:#FF7A45
  .bluefont
    color:#409EFF
  .pass-line
    padding:15px 0
    box-sizing:border-box
    font-size:14px
    text-decoration:underline
    color:#409EFF
  .bottom-btn
    margin-top:30px
  .el-icon-arrow-right
    display:none
  .el-collapse-item__arrow
    display:none
  .mt20
    margin-top:20px
  .pb20
    padding-bottom:20px


  
  
 

</style>
